import { NoSkinCellRenderer } from "../../../common/item/NoSkinCellRenderer";
import { SGuildPlayerAttendanceVo } from "../vo/SGuildPlayerAttendanceVo";
import { AvatarInfo } from "../../../../resource/info/AvatarInfo";
import { AvatarType } from "../../../../resource/info/AvatarType";
import { ImageInfo } from "../../../../../../com/gengine/resource/info/ImageInfo";
import { Dispatcher } from "../../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../../events/DataEvent";
import { EventName } from "../../../../mvc/EventName";
import { ObjCreate } from "../../../common/ObjCreate";
import { ImagesConst } from "../../../../resource/ImagesConst";
import { Language } from "../../../../../../extend/language/Language";
import { GTextFiled } from "../../../../../../com/mui/controls/GTextFiled";
import { GButton } from "../../../../../../com/mui/controls/GButton";
//class MultiAllocationItemRenderer
    
    export  class MultiAllocationItemRenderer extends NoSkinCellRenderer
    {
        constructor()
        {
            super();
            this.init();
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var arg0: Object;
            var imgName: string;

            var loc1;
            arg0 = arg1;
            super.data = arg0 as SGuildPlayerAttendanceVo;
            this._itemData = arg0 as SGuildPlayerAttendanceVo;
            this._name.text = this._itemData.itemData.miniPlayer.name;
            imgName = AvatarInfo.getPlayerAvatarName(this._itemData.itemData.miniPlayer.camp, this._itemData.itemData.miniPlayer.sex, AvatarType.FRIEND, this._itemData.itemData.miniPlayer.avatarId);
            with ({}) 
            {
            };
            imgName.load(
#error('pushwith') {}
            , 
#error('pushwith') {}
            .onAvatarLoaded = (arg1: ImageInfo): void
            {
                _avatarBitmap.bitmapData = arg1.bitmapData;
                _avatarBitmap.width = 20;
                _avatarBitmap.height = 20;
                return;
            })
            return;
        }

        /* internal  */onCancelHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.MultiAllocationCancelItem, data as SGuildPlayerAttendanceVo));
            return;
        }

        /* internal  */init(): void
        {
            ObjCreate.createBg(0, 31, 380, 3, this, ImagesConst.SplitLine);
            this._avatarBitmap = new Object /* flash.display.Bitmap */();
            ObjCreate.setObjAttri(this._avatarBitmap, 15, 5, 20, 20, this);
            this._name = ObjCreate.createGTextField("", 60, 6, 80, 20, this);
            this._cancelBtn = ObjCreate.createGButton(Language.getString(27969), 180, 3, 49, 26, this);
            this._cancelBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onCancelHandler);
            return;
        }

        /* internal */ /* var */_avatarBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_name: GTextFiled;

        /* internal */ /* var */_cancelBtn: GButton;

        /* internal */ /* var */_itemData: SGuildPlayerAttendanceVo;
    }
